function postAjax(url, param, callback) {
    $.ajax({
        type: "post",
        url: url,
        sync: false,
        data: JSON.stringify(param),
        dataType: "json",
        contentType: "application/json",
        success: callback,
        error: function(err) {
            console.log(err);
            layer.msg("系统异常!!!")
        }
    });
}

//回调地狱
//1.封装
/*function reject(res) {
    console.log(err);
    layer.msg("系统异常!!!")
}*/
function PostData(url , data = {}) {
    return new Promise((resolve , reject) => {
        $.ajax({
            //发送请求
            type: "post",
            url: url,
            data: JSON.stringify(data),
            dataType: "json",
            contentType: "application/json",
            success: function (res) {
                resolve(res)
            },
            error: function (res) {
                reject(res)
            }
        })
    })
}



